package com.lyj.myselfrule;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 修改ribbon默认的负载均衡策略-随机：如轮询，随机等
 */
@Configuration
public class MyselfRule {
    @Bean
    public IRule myIrule() {
        return new RandomRule();// 修改ribbon默认的负载均衡策略-随机。 Ribbon默认轮询负载均衡策略
    }
}
